<%@ page language="java" pageEncoding="UTF-8"%>

<%
	String SSOLoginPage =request.getSession().getServletContext().getInitParameter("SSOLoginPage");

	String CookieName =request.getSession().getServletContext().getInitParameter("CookieName");
	
	CookieName =CookieName.toLowerCase().trim();
	
	Cookie[] cookies=   request.getCookies();
	
	Cookie loginCookie =null;
	
	String cookname ="";
	
	if(cookies!=null){
	
	    for(Cookie cookie:cookies){
	
	        cookname =cookie.getName().trim().toLowerCase();
	
	       if(CookieName.equals(cookname)){
	
	           loginCookie =cookie;
	
	           break;
	
	       }
	
	    }
	
	}
	System.out.println(loginCookie);
	if(loginCookie==null){
	
	    String url =request.getRequestURL().toString();
	
	    response.sendRedirect(SSOLoginPage+"?goto="+url);
	
	}
%>



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>



<title>ssowebdemo1</title>

<meta http-equiv="pragma" content="no-cache">

<meta http-equiv="cache-control" content="no-cache">

<meta http-equiv="expires" content="0">

<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">

<meta http-equiv="description" content="This is my page">



</head>



<body>

	WELCOME SsoWebDemo1 !
	<br>

</body>

</html>